package com.kaifamiao.demo.d0729.am;

public class Demo03 {


    public static void main(String[] args) {

        Pet pet = new HSQDog();
        // pet 是父类类型变量 引用 子类对象
        Dog d = (Dog) pet;
        Pet pet1 = new Cat();

        System.out.println(Dog.class);
        System.out.println(pet.getClass());
        System.out.println(pet1.getClass());

        if (pet.getClass() == Dog.class){
            Dog dog = (Dog) pet;
            dog.lookDoor();
        }

    }
}
